﻿using System.Data;


namespace dados
{
    public class MenuClass : FrameworkBase
    {

        public DataSet Carregar()
        {

            DataSet ds = ExecutarQueryDS(@"Select Codigo as MenuID, 
                                                  Descricao as Description, 
                                                  Descricao as Text, 
                                                  CATEGORIA_PAI as ParentID
                                                  from Categoria
                                                  where ATIVO = 'S'
                                                  Order by Ordem");

            ds.DataSetName = "Menus";
            ds.Tables[0].TableName = "Menu";

            DataRelation relation = new DataRelation("ParentChild",
               ds.Tables["Menu"].Columns["MenuID"],
               ds.Tables["Menu"].Columns["ParentID"],
               true);


            relation.Nested = true;
            ds.Relations.Add(relation);
            return ds;
        }
    }


}

